package com.zhang.spring.c_prcxy;

import org.junit.Test;

import sun.security.jca.GetInstance.Instance;

import com.zhang.spring.Service.userService;
import com.zhang.spring.Service.userServiceimpl;


public class demo {
	@Test
	public void fun1(){
		//动态代理测试
		userService us=new userServiceimpl();
		userPrcxyFactory usf=new userPrcxyFactory(us);
		userService uspxory=usf.getUserServiceFactory();
		uspxory.save();
		System.out.println(uspxory instanceof userServiceimpl	);//false
		
	}
	@Test
	public void fun2(){
		//CGLIB测试
		userprcxyFactory02 usf=new userprcxyFactory02();
		userService uspxory=usf.getUserServiceFactory();
		uspxory.save();
		//判断代理对象是否是被代理对象
		System.out.println(uspxory instanceof userServiceimpl	);//true

	}
}

